﻿@using Entity.ProjectEnt;
@{
    ViewBag.Title = "Form";
    Layout = "~/Views/Shared/_Form.cshtml";
    CarriageBoxEntity thisobj = ViewData["objs"] as CarriageBoxEntity;
    if (thisobj == null)
    {
        thisobj = new CarriageBoxEntity();
    }
    List<CustomerAndThingsNameEntity> thingsNameObjList = ViewData["ThingsName"] as List<CustomerAndThingsNameEntity>;
    List<CustomerAndThingsNameEntity> boxTypeObjList = ViewData["boxTypx"] as List<CustomerAndThingsNameEntity>;
}
<script>
    var keyValue = $.request("keyValue");
    $(function () {
        if (!!keyValue) {
            $.ajax({
                url: "/Project/CarriageBox/GetFormJson",
                data: { keyValue: keyValue },
                dataType: "json",
                async: false,
                success: function (data) {
                    $("#form1").formSerialize(data);
                }
            });
        } else {
            $("#form1").formSerialize("add");
        }
    });
    function submitForm() {
        var postData = $("#form1").formSerialize();
        if (!$('#form1').formValid()) {
            return false;
        }
        debugger;
        $.submitForm({
            url: "/Project/CarriageBox/SubmitForm?keyValue=" + keyValue,
            param: postData,
            success: function () {
                $.currentWindow().$("#gridList").trigger("reloadGrid");
            }
        })
    }
</script>
<form id="form1">
    <div style="margin-top: 10px; margin-left: 10px; margin-right: 10px;">
        <ul class="nav nav-tabs">
            <li class="active"><a href="#">基本信息</a></li>
        </ul>
        <div style="padding-top: 20px; margin-right: 30px;">
            <table class="form">
                <tr>
                    <th class="formTitle">箱号编号</th>
                    <td class="formValue">
                        <input id="CarriageBoxID" name="CarriageBoxID" type="text" class="form-control required" placeholder="请输入箱号编号" />
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">到站所属车号</th>
                    <td class="formValue">
                        <input id="InitBelongCarriageId" name="InitBelongCarriageId" type="text" class="form-control required" placeholder="请输入车号" />
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">品名</th>
                    <td class="formValue">
                        <select id="ThingsName" name="ThingsName" style="width: 100%; height: 30px">
                            @{
                                if (thingsNameObjList != null && thingsNameObjList.Count > 0)
                                {
                                    foreach (var item in thingsNameObjList)
                                    {
                                        if (thisobj.ThingsName == item.Name)
                                        {
                                            <option value=@item.Name selected="selected">@item.Name</option>
                                        }
                                        else
                                        {
                                            <option value=@item.Name>@item.Name</option>
                                        }

                                    }
                                }

                            }
                        </select>
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">箱主</th>
                    <td class="formValue">
                        <select id="ThingsName" name="ThingsName" style="width: 100%; height: 30px">
                            @{
                                if (boxTypeObjList != null && boxTypeObjList.Count > 0)
                                {
                                    foreach (var item in boxTypeObjList)
                                    {
                                        if (thisobj.BoxType == item.Name)
                                        {
                                            <option value=@item.Name selected="selected">@item.Name</option>
                                        }
                                        else
                                        {
                                            <option value=@item.Name>@item.Name</option>
                                        }
                                    }
                                }

                            }
                        </select>
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">封号</th>
                    <td class="formValue">
                        <input id="FenHao" name="FenHao" type="text" class="form-control required" placeholder="请输入封号" />
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">蓬布号</th>
                    <td class="formValue">
                        <input id="Tarpaulin" name="Tarpaulin" type="text" class="form-control required" placeholder="请输入蓬布号" />
                    </td>
                </tr>
                <tr>
                    <th class="formTitle" colspan="1">备注说明</th>
                    <td class="formValue" colspan="3">
                        <textarea id="Remark" name="Remark" class="form-control" style="height: 60px;"></textarea>
                    </td>
                </tr>
            </table>
        </div>
    </div>
</form>
